import $request from '@/utils/request'

export default ({ host = "" }) => ({
    async search(data = {}) {
        return await $request({
            url: `${host}/stock/search`,
            method: "get",
            data
        })
    },
    holding: {
        async list(data = {}) {
            return await $request({
                url: `${host}/stock/holding/list`,
                method: "get",
                data,
            })
        }
    },
    optional: {
        async list(data = {}) {
            return await $request({
                url: `${host}/stock/optional/list`,
                method: "get",
                data,
            })
        }
    },
    recommend: {
        async list(data = {}) {
            return await $request({
                url: `${host}/stock/recommend/list`,
                method: "get",
                data,
            })
        }
    },
    async details(data = {}) {
        return await $request({
            url: `${host}/stock/details`,
            method: "post",
            data
        })
    },
    async realtime(data = {}) {
        return await $request({
            url: `${host}/stock/realtime`,
            method: "get",
            data,
            loading: false
        })
    }
})